The embodiments relate to aggregation of data to find distinct values. More specifically, the embodiments relate to evaluating an aggregate payload and its format, and dynamically migrating the payload to a different format under one or more select conditions.
A query is a request for information from a database. In general, a query submission to a database returns records that match the query criteria. An aggregate function is a function that performs a computation on a set of values across a result set. In general, database management systems support a set of aggregate functions that can operate on a set of selected records. The aggregate function may be part of a query with the function producing an output of data. Data is produced form the aggregation function, and is generally stored in a data structure format to maintain the data needed to produce the result of the aggregation function. The data structure format is referred to herein as a payload format.
It is understood that an aggregation to find distinct values may vary, with some aggregations having a minimal set of values, and other aggregations having a large set of values. For aggregations with a large set of values, it is understood that the payload format in the form of a hash table may be maintained to store distinct values. However, for the group with a minimal set of values, the use of a hash table is not efficient. Accordingly, the same payload format is not efficient for each aggregation group.